package com.mrd.gtimpframe.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.mrd.util.StringUtils;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

public class BizProtocolConfirm implements Serializable {
    /**
     * 待确认
     */
    public static final String TO_BE_CONFIRM = "0";
    /**
     * 已确认
     */
    public static final String CONFIRMED = "1";
    /**
     * 驳回
     */
    public static final String REJECT_CONFIRM = "2";

    /**
     * 无效
     */
    public static final String UNVALID = "4";

    private String id;

    private String protocolUniteId;
    private String protocolUniteName;

    private String supId;

    private String supName;

    private Date startTime;

    private Date endTime;

    private String rejectReason;

    private String status;

    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    private String creator;

    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date modifiyTime;

    private String modifier;

    private static final long serialVersionUID = 1L;

    public BizProtocolConfirm(String id, String protocolUniteId, String supId, Date startTime, Date endTime, String rejectReason, String status, Date createTime, String creator, Date modifiyTime, String modifier) {
        this.id = id;
        this.protocolUniteId = protocolUniteId;
        this.supId = supId;
        this.startTime = startTime;
        this.endTime = endTime;
        this.rejectReason = rejectReason;
        this.status = status;
        this.createTime = createTime;
        this.creator = creator;
        this.modifiyTime = modifiyTime;
        this.modifier = modifier;
    }

    public BizProtocolConfirm(String id, String protocolUniteId,String protocolUniteName,  String supId, String supName, Date startTime, Date endTime, String rejectReason, String status, Date createTime, String creator, Date modifiyTime, String modifier) {
        this.id = id;
        this.protocolUniteName = protocolUniteName;
        this.protocolUniteId = protocolUniteId;
        this.supId = supId;
        this.supName = supName;
        this.startTime = startTime;
        this.endTime = endTime;
        this.rejectReason = rejectReason;
        this.status = status;
        this.createTime = createTime;
        this.creator = creator;
        this.modifiyTime = modifiyTime;
        this.modifier = modifier;
    }

    public BizProtocolConfirm() {
        super();
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id == null ? null : id.trim();
    }

    public String getSupId() {
        return supId;
    }

    public void setSupId(String supId) {
        this.supId = supId == null ? null : supId.trim();
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public String getRejectReason() {
        return rejectReason;
    }

    public void setRejectReason(String rejectReason) {
        this.rejectReason = rejectReason == null ? null : rejectReason.trim();
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status == null ? null : status.trim();
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getCreator() {
        return creator;
    }

    public void setCreator(String creator) {
        this.creator = creator == null ? null : creator.trim();
    }

    public Date getModifiyTime() {
        return modifiyTime;
    }

    public void setModifiyTime(Date modifiyTime) {
        this.modifiyTime = modifiyTime;
    }

    public String getModifier() {
        return modifier;
    }

    public void setModifier(String modifier) {
        this.modifier = modifier == null ? null : modifier.trim();
    }

    public String getProtocolUniteId() {
        return protocolUniteId;
    }

    public void setProtocolUniteId(String protocolUniteId) {
        this.protocolUniteId = protocolUniteId;
    }

    public String getProtocolUniteName() {
        return protocolUniteName;
    }

    public void setProtocolUniteName(String protocolUniteName) {
        this.protocolUniteName = protocolUniteName;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", supId=").append(supId);
        sb.append(", startTime=").append(startTime);
        sb.append(", endTime=").append(endTime);
        sb.append(", rejectReason=").append(rejectReason);
        sb.append(", status=").append(status);
        sb.append(", createTime=").append(createTime);
        sb.append(", creator=").append(creator);
        sb.append(", modifiyTime=").append(modifiyTime);
        sb.append(", modifier=").append(modifier);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        BizProtocolConfirm other = (BizProtocolConfirm) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getSupId() == null ? other.getSupId() == null : this.getSupId().equals(other.getSupId()))
            && (this.getStartTime() == null ? other.getStartTime() == null : this.getStartTime().equals(other.getStartTime()))
            && (this.getEndTime() == null ? other.getEndTime() == null : this.getEndTime().equals(other.getEndTime()))
            && (this.getRejectReason() == null ? other.getRejectReason() == null : this.getRejectReason().equals(other.getRejectReason()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getCreator() == null ? other.getCreator() == null : this.getCreator().equals(other.getCreator()))
            && (this.getModifiyTime() == null ? other.getModifiyTime() == null : this.getModifiyTime().equals(other.getModifiyTime()))
            && (this.getModifier() == null ? other.getModifier() == null : this.getModifier().equals(other.getModifier()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getSupId() == null) ? 0 : getSupId().hashCode());
        result = prime * result + ((getStartTime() == null) ? 0 : getStartTime().hashCode());
        result = prime * result + ((getEndTime() == null) ? 0 : getEndTime().hashCode());
        result = prime * result + ((getRejectReason() == null) ? 0 : getRejectReason().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getCreator() == null) ? 0 : getCreator().hashCode());
        result = prime * result + ((getModifiyTime() == null) ? 0 : getModifiyTime().hashCode());
        result = prime * result + ((getModifier() == null) ? 0 : getModifier().hashCode());
        return result;
    }

    public String getStatuLabel(){
        if(StringUtils.isNotEmpty(this.status)){
            if(TO_BE_CONFIRM.equals(this.status)){
                return "待确认";
            }else if(CONFIRMED.equals(this.status)){
                return "已确认";
            }else if(REJECT_CONFIRM.equals(this.status)){
                return "已驳回";
            }
        }
        return null;
    }

    public String getSupName() {
        return supName;
    }

    public void setSupName(String supName) {
        this.supName = supName;
    }
}
